<script runat="server">
protected void Button1_OnClick(object sender, EventArgs e)
{
if (PeterBlum.DES.Globals.WebFormDirector.IsValid)
{
}
}
</script>
<p>
In this example, Sunday and Wednesday are not valid. The <span class="ControlClass">PeterBlum.DES.Web.WebControls.SpecialDayOfWeek</span>
objects provide a string to show in the validator's error message. That string is defined
in the Label property and shown by using the {DATELABEL} token in the
<span class="PropertyName">UnselectableDatesValidator.ErrorMessage</span> property.
If no label is defined, it falls back to the value in
<span class="PropertyName">UnselectableDatesValidator.NoLabelErrorMessage</span>.</p>
<p>
Enter dates in the textbox. When you enter a date that is Sunday or Wednesday, an error is shown.
Also note that the DateTextBox's calendar follows the rules of the SpecialDates control.
</p>
<des:DateTextBox ID="DateTextBox1" runat="server" SpecialDatesControlID="SpecialDates1" Hint="Closed on Sundays and Wednesday" />
<des:UnselectableDatesValidator ID="UnselectableDatesValidator1" runat="server"
ControlIDToEvaluate="DateTextBox1"
ErrorMessage="That date cannot be used. We are closed on {DATELABEL}."
NoLabelErrorMessage="that date" />
<des:SpecialDates ID="SpecialDates1" runat="server" UnknownDatesAreUnselectable="False">
<des:SpecialDayOfWeek Label="Sundays" Selectable="Unselectable" DayOfWeek="Sunday"></des:SpecialDayOfWeek>
<des:SpecialDayOfWeek Label="Wednesdays" Selectable="Unselectable" DayOfWeek="Wednesday"></des:SpecialDayOfWeek>
</des:SpecialDates>
<br/>
<br/>
<des:Button ID="Button1" runat="server" Text="Client Side" OnClick="Button1_OnClick" />